/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package gui;

import controllers.GUIController;
import hibernate.Activity;
import java.awt.event.*;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.*;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;

/**
 *
 * @author Owner
 */
public class AAddActivity extends javax.swing.JInternalFrame {

    private GUIController guiC;
    private List<Activity> activitiesList = new ArrayList();
    private Activity currentActivity = new Activity();
    private File imageFile = new File("imageFile");
    private File soundFile = new File("soundFile");
    private DefaultListModel listModel = new DefaultListModel();
    private static final String UPDATE = "Update";
    private static final String SAVE = "Save";
    final AAddActivity obj = this;

    public AAddActivity(GUIController m) {
        guiC = m;
        initComponents();
        addModPanel.setVisible(false);
        add_AddActivityActionListener();
        add_BrowsePicActionListener();
        add_BrowseSoundActionListener();
        add_SaveButtonActionListener();
        add_HomeActionListener();
        add_MyAccountActionListener();
        add_LogoutActionListener();
        add_CancelActionListener();
        add_ActivitiesActionListener();
        add_DeleteButtonActionListener();
        add_ActivityListSelectionListener();

        updateActivitiesJList();
        updateSaveButtonLabel(false);

    }

    private void add_ActivitiesActionListener() {
        activitiesButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                guiC.showGUI(new AAddActivity(guiC));
                obj.dispose();
            }
        });
    }

    // adds actionlistener to the logout button to log the admin out of their
    // account
    private void add_LogoutActionListener() {
        logoutButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                // show login page/close application on logout
                guiC.showGUI(new ALogin(guiC));
                // close previous gui(AMyClass)
                obj.dispose();
            }
        });
    }

    private void add_CancelActionListener() {
        cancelButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                clearSelectedActivity();
            }
        });

    }

    // adds actionlistener to myaccount button to go to the page My Class
    private void add_MyAccountActionListener() {
        myAccountButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                try {
                    guiC.showGUI(new AMyAccount(guiC));
                } catch (IOException ex) {
                    Logger.getLogger(AAddActivity.class.getName()).log(Level.SEVERE, null, ex);
                }
                obj.dispose();
            }
        });
    }

    //adds actionlistener to home button to go to the home page
    private void add_HomeActionListener() {
        homeButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                guiC.showGUI(new AMyClass(guiC));
                obj.dispose();
            }
        });
    }

    public void add_AddActivityActionListener() {
        addActButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                clearSelectedActivity();
                addModPanel.setVisible(true);
                currentActivity = new Activity();
                updateSaveButtonLabel(false);
                addModPanel.setVisible(true);
            }
        });
    }

    public void add_BrowsePicActionListener() {
        browsePicButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                JFileChooser fc = new JFileChooser();
                int retVal = fc.showOpenDialog(null);
                if (retVal == JFileChooser.APPROVE_OPTION) {
                    File file = fc.getSelectedFile();
                    viewActivityPic.setIcon(new ImageIcon(file.getAbsolutePath()));
                    imageFile = file;
                }

            }
        });
    }

    public void add_BrowseSoundActionListener() {
        browseSoundButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                actSoundField.setText("");
                JFileChooser fc = new JFileChooser();
                int retVal = fc.showOpenDialog(null);
                if (retVal == JFileChooser.APPROVE_OPTION) {
                    File file = fc.getSelectedFile();
                    actSoundField.setText(file.getName());
                    soundFile = file;
                }

            }
        });
    }

        private void add_ActivityListSelectionListener() {
            activityJList.addListSelectionListener(new ListSelectionListener() {
                @Override
                public void valueChanged(ListSelectionEvent e) {
                    int index = activityJList.getSelectedIndex();
                    if (index > -1) {
                        Activity a = activitiesList.get(activityJList.getSelectedIndex());
                        currentActivity = a;
                        addModPanel.setVisible(true);
                        showSelectedActivity(currentActivity);
                        setFilesOnSelection();
                        updateSaveButtonLabel(true);
                    }
                }
            });

        }

    private void setFilesOnSelection() {
        if (currentActivity.getImage() != null) {
            imageFile = currentActivity.getImage();
            viewActivityPic.setIcon(new ImageIcon(imageFile.getAbsolutePath()));
        }
        if (currentActivity.getSound() != null) {
            soundFile = currentActivity.getSound();
        }
    }

    private void updateSaveButtonLabel(boolean selectedItem) {

        if (selectedItem) {
            saveButton.setText(UPDATE);
        } else {
            saveButton.setText(SAVE);
        }
    }

    private void add_SaveButtonActionListener() {
        saveButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                switch (saveButton.getText()) {
                    case SAVE: {
                        saveActivity(currentActivity);
                        clearSelectedActivity();
                        break;
                    }
                    case UPDATE: {
                        updateActivity();
                        clearSelectedActivity();
                        updateActivitiesJList();
                        break;
                    }
                }
            }
        });
    }

    private void add_DeleteButtonActionListener() {
        deleteButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                boolean verifyDelete = verifyDeleteActivity();
                if (verifyDelete) {
                    listModel.removeElementAt(activityJList.getSelectedIndex());
                    activityJList.clearSelection();
                    activitiesList.remove(currentActivity);
                    deleteActivity(currentActivity);
                    currentActivity = null;
                    updateActivitiesJList();
                    addModPanel.setVisible(false);

                }
            }
        });
    }

    private boolean verifyDeleteActivity() {
        int dialogResult = JOptionPane.NO_OPTION;
        JOptionPane.showConfirmDialog(null, "Are you sure you want to delete this activity?", "Warning", dialogResult);
        if (dialogResult == 1) {
            return true;
        }
        return false;
    }

    private void deleteActivity(Activity a) {
        guiC.deleteDbData(a);
    }

    private void saveActivity(Activity a) {
        if (currentActivity.getName().matches("")
                || (!currentActivity.getName().matches(actNameField.getText()))) {
            currentActivity.setName(actNameField.getText());

        }
        if (validateActivityInformation()) {
            copyImageAndSoundFiles();
            guiC.saveDbData(currentActivity);
            
            updateActivitiesJList();
        }

    }

    private void updateActivity() {
        if (validateUpdatedActivityInformation()) {
            
                currentActivity.setImage(imageFile);
                currentActivity.setSound(soundFile);
                currentActivity.setName(actNameField.getText());
                guiC.updateDbData(currentActivity);
                updateActivitiesJList();
        }
    }
    

    private void copyImageAndSoundFiles() {
        Activity a = new Activity(currentActivity);
        currentActivity = guiC.copyActivityImageAndSoundFiles(imageFile, soundFile, a);
    }

    private boolean validateUpdatedActivityInformation(){
        boolean flag = true;
        if (currentActivity.getName().matches("")) {
            flag = false;
            JOptionPane.showMessageDialog(null, "Activity name cannot be blank.");
        }
        
        for (Iterator i = activitiesList.iterator(); i.hasNext() && flag;) {
            Activity a = (Activity) i.next();
            if (currentActivity.getName().matches(a.getName()) && saveButton.getText().matches(SAVE)) {
                flag = false;
                JOptionPane.showMessageDialog(null, "Activity name cannot have the same name as another activity.");
            }
        }
        
        
        return flag;
    }
    
    private boolean validateActivityInformation() {
        boolean flag = true;
        if (currentActivity.getName().matches("")) {
            flag = false;
            JOptionPane.showMessageDialog(null, "Activity name cannot be blank.");
        }
        for (Iterator i = activitiesList.iterator(); i.hasNext() && flag;) {
            Activity a = (Activity) i.next();
            if (currentActivity.getName().matches(a.getName()) && saveButton.getText().matches(SAVE)) {
                flag = false;
                JOptionPane.showMessageDialog(null, "Activity name cannot have the same name as another activity.");
            }
        }

        if (!imageFile.exists() && flag) {
            JOptionPane.showMessageDialog(null, "Activity Image does not exist.");
            flag = false;
        }

        if (!soundFile.exists() && flag) {
            JOptionPane.showMessageDialog(null, "Activity Sound does not exist.");
            flag = false;
        }
        return flag;
    }
  
    private void showSelectedActivity(Activity a) {
        clearSelectedActivity();
        actNameField.setText(a.getName());
        actSoundField.setText(a.getPhonetic());
        addModPanel.setVisible(true);
        currentActivity = a;
    }

    private void clearSelectedActivity() {
        viewActivityPic.setIcon(null);
        actNameField.setText("");
        actSoundField.setText("");
        addModPanel.setVisible(false);
        currentActivity = null;
    }

    private void updateActivitiesJList() {
        
        listModel.removeAllElements();
        
        Activity a;
        List tempList = new ArrayList();
        tempList = guiC.getActivityList();
        for (Iterator i = tempList.iterator(); i.hasNext();) {
            a = (Activity) i.next();
            listModel.addElement(a.getName());
        }
        activityJList.setModel(listModel);
        
        activitiesList = tempList;

    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        mainScrollPane = new javax.swing.JScrollPane();
        bkgrd = new javax.swing.JPanel();
        logo = new javax.swing.JLabel();
        buttonPanel = new javax.swing.JPanel();
        homeButton = new javax.swing.JButton();
        myAccountButton = new javax.swing.JButton();
        logoutButton = new javax.swing.JButton();
        activitiesButton = new javax.swing.JButton();
        activitiesPanel = new javax.swing.JPanel();
        addActButton = new javax.swing.JButton();
        jScrollPane2 = new javax.swing.JScrollPane();
        activityJList = new javax.swing.JList();
        addModPanel = new javax.swing.JPanel();
        saveButton = new javax.swing.JButton();
        deleteButton = new javax.swing.JButton();
        cancelButton = new javax.swing.JButton();
        viewActivityPic = new javax.swing.JLabel();
        browsePicButton = new javax.swing.JButton();
        actNameLabel = new javax.swing.JLabel();
        actNameField = new javax.swing.JTextField();
        actPicLabel = new javax.swing.JLabel();
        actSoundLabel = new javax.swing.JLabel();
        browseSoundButton = new javax.swing.JButton();
        jScrollPane1 = new javax.swing.JScrollPane();
        actSoundField = new javax.swing.JTextField();

        
        
        bkgrd.setBackground(new java.awt.Color(0, 102, 255));

        logo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/gui/OnPointlogo2-1.png"))); // NOI18N

        buttonPanel.setOpaque(false);

        homeButton.setText("Home");
        homeButton.setOpaque(false);

        myAccountButton.setText("MyAccount");
        myAccountButton.setOpaque(false);

        logoutButton.setText("Logout");
        logoutButton.setOpaque(false);

        activitiesButton.setText("Activities");

        javax.swing.GroupLayout buttonPanelLayout = new javax.swing.GroupLayout(buttonPanel);
        buttonPanel.setLayout(buttonPanelLayout);
        buttonPanelLayout.setHorizontalGroup(
                buttonPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(buttonPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(buttonPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                .addComponent(myAccountButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(homeButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(logoutButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(activitiesButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
        buttonPanelLayout.setVerticalGroup(
                buttonPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(buttonPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(homeButton)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(myAccountButton)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(activitiesButton)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(logoutButton)
                .addContainerGap(145, Short.MAX_VALUE)));

        activitiesPanel.setBackground(new java.awt.Color(53, 153, 255));
        activitiesPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Activities", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Aharoni", 0, 12))); // NOI18N

        addActButton.setText("Add Activity");
        addActButton.setOpaque(false);

        activityJList.setName(""); // NOI18N
        jScrollPane2.setViewportView(activityJList);

        javax.swing.GroupLayout activitiesPanelLayout = new javax.swing.GroupLayout(activitiesPanel);
        activitiesPanel.setLayout(activitiesPanelLayout);
        activitiesPanelLayout.setHorizontalGroup(
                activitiesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, activitiesPanelLayout.createSequentialGroup()
                .addContainerGap(187, Short.MAX_VALUE)
                .addComponent(addActButton)
                .addContainerGap())
                .addGroup(activitiesPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 188, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
        activitiesPanelLayout.setVerticalGroup(
                activitiesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, activitiesPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 320, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(addActButton)));

        addModPanel.setBackground(new java.awt.Color(53, 153, 255));
        addModPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Add/Modify Activity", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Aharoni", 1, 12))); // NOI18N

        saveButton.setText("Save Changes");
        saveButton.setOpaque(false);

        deleteButton.setText("Delete");
        deleteButton.setOpaque(false);

        cancelButton.setText("Cancel");
        cancelButton.setOpaque(false);

        viewActivityPic.setOpaque(true);

        browsePicButton.setText("Browse");
        browsePicButton.setOpaque(false);

        actNameLabel.setText("Activity Name: ");

        actPicLabel.setText("Activity Picture");

        actSoundLabel.setText("Activity Sound: ");

        browseSoundButton.setText("Browse");
        browseSoundButton.setOpaque(false);

        jScrollPane1.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
        jScrollPane1.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);

        actSoundField.setColumns(20);
        actSoundField.setEditable(false);
        jScrollPane1.setViewportView(actSoundField);

        javax.swing.GroupLayout addModPanelLayout = new javax.swing.GroupLayout(addModPanel);
        addModPanel.setLayout(addModPanelLayout);
        addModPanelLayout.setHorizontalGroup(
                addModPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(addModPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(addModPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(addModPanelLayout.createSequentialGroup()
                .addGroup(addModPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(addModPanelLayout.createSequentialGroup()
                .addComponent(actNameLabel)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(actNameField, javax.swing.GroupLayout.PREFERRED_SIZE, 222, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 31, Short.MAX_VALUE))
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, addModPanelLayout.createSequentialGroup()
                .addGap(0, 0, Short.MAX_VALUE)
                .addComponent(saveButton)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(deleteButton)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(cancelButton))
                .addGroup(addModPanelLayout.createSequentialGroup()
                .addComponent(actSoundLabel)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(25, 25, 25)
                .addComponent(browseSoundButton)
                .addGap(0, 0, Short.MAX_VALUE))
                .addGroup(addModPanelLayout.createSequentialGroup()
                .addGroup(addModPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(actPicLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 86, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGroup(addModPanelLayout.createSequentialGroup()
                .addComponent(viewActivityPic, javax.swing.GroupLayout.PREFERRED_SIZE, 132, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(browsePicButton)))
                .addContainerGap()))));
        addModPanelLayout.setVerticalGroup(
                addModPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(addModPanelLayout.createSequentialGroup()
                .addGap(197, 197, 197)
                .addComponent(actSoundLabel)
                .addGap(32, 32, 32)
                .addGroup(addModPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                .addComponent(actNameLabel)
                .addComponent(actNameField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(addModPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                .addComponent(saveButton)
                .addComponent(deleteButton)
                .addComponent(cancelButton)))
                .addGroup(addModPanelLayout.createSequentialGroup()
                .addGap(18, 18, 18)
                .addGroup(addModPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                .addComponent(browseSoundButton)
                .addGroup(addModPanelLayout.createSequentialGroup()
                .addComponent(actPicLabel)
                .addGroup(addModPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(addModPanelLayout.createSequentialGroup()
                .addGap(15, 15, 15)
                .addComponent(browsePicButton))
                .addGroup(addModPanelLayout.createSequentialGroup()
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(viewActivityPic, javax.swing.GroupLayout.PREFERRED_SIZE, 127, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(29, 29, 29)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(0, 0, Short.MAX_VALUE)));

        javax.swing.GroupLayout bkgrdLayout = new javax.swing.GroupLayout(bkgrd);
        bkgrd.setLayout(bkgrdLayout);
        bkgrdLayout.setHorizontalGroup(
                bkgrdLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(bkgrdLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(bkgrdLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(logo)
                .addGroup(bkgrdLayout.createSequentialGroup()
                .addComponent(buttonPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(34, 34, 34)
                .addComponent(activitiesPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(addModPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(473, Short.MAX_VALUE)));
        bkgrdLayout.setVerticalGroup(
                bkgrdLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(bkgrdLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(logo)
                .addGap(43, 43, 43)
                .addGroup(bkgrdLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(bkgrdLayout.createSequentialGroup()
                .addComponent(buttonPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGap(266, 266, 266))
                .addGroup(bkgrdLayout.createSequentialGroup()
                .addGroup(bkgrdLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                .addComponent(addModPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(activitiesPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))));

        mainScrollPane.setViewportView(bkgrd);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(mainScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 1071, Short.MAX_VALUE));
        layout.setVerticalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(mainScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 687, Short.MAX_VALUE));

        pack();
    }// </editor-fold>//GEN-END:initComponents
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JTextField actNameField;
    private javax.swing.JLabel actNameLabel;
    private javax.swing.JLabel actPicLabel;
    private javax.swing.JTextField actSoundField;
    private javax.swing.JLabel actSoundLabel;
    private javax.swing.JButton activitiesButton;
    private javax.swing.JPanel activitiesPanel;
    private javax.swing.JList activityJList;
    private javax.swing.JButton addActButton;
    private javax.swing.JPanel addModPanel;
    private javax.swing.JPanel bkgrd;
    private javax.swing.JButton browsePicButton;
    private javax.swing.JButton browseSoundButton;
    private javax.swing.JPanel buttonPanel;
    private javax.swing.JButton cancelButton;
    private javax.swing.JButton deleteButton;
    private javax.swing.JButton homeButton;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JLabel logo;
    private javax.swing.JButton logoutButton;
    private javax.swing.JScrollPane mainScrollPane;
    private javax.swing.JButton myAccountButton;
    private javax.swing.JButton saveButton;
    private javax.swing.JLabel viewActivityPic;
    // End of variables declaration//GEN-END:variables
}
